incorporate review changes.
authortsteven4 <tsteven4@gmail.com>
Fri, 1 Mar 2019 14:37:41 +0000 (07:37 -0700)
committertsteven4 <tsteven4@gmail.com>
Fri, 1 Mar 2019 14:37:41 +0000 (07:37 -0700)
defs.h
gtm.cc
main.cc
reverse_route.cc
route.cc

diff --git a/defs.h b/defs.h
index 087cb72a5d5685307b2902cc74b79b0036e1a661..5684bd26d5a8fc3639559ddd5daf2eba81ae387f 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -745,7 +745,6 @@ void track_del_wpt(route_head* rte, Waypoint* wpt);
 void route_disp(const route_head* rte, std::nullptr_t /* waypt_cb */); /* override to catch nullptr */
 //void route_disp_all(route_hdr, route_trl, waypt_cb); /* template */
 //void track_disp_all(route_hdr, route_trl, waypt_cb); /* template */
-void route_reverse(const route_head* rte_hd);
 void route_disp_session(const session_t* se, route_hdr rh, route_trl rt, waypt_cb wc);
 void track_disp_session(const session_t* se, route_hdr rh, route_trl rt, waypt_cb wc);
 void route_flush_all_routes();
diff --git a/gtm.cc b/gtm.cc
index c5ab84729198f06c405d96e139792d5f3ef44969..76978377d3d1b9877faa471c0a4960ad6dc549e3 100644 (file)
--- a/gtm.cc
+++ b/gtm.cc
@@ -585,13 +585,17 @@ gtm_read()
   /* Tracklog styles */
   // TODO: The format document states there are ts_count tracklog style entries,
   //       and tr_count tracklog entries.
-  //       Some tracklog entries may be contiuation entries, so we turn these into
-  //       real_track_list.size() <= tr_count tracks.
-  //       If ts_count != real_track_list.size() we don't know how to line up the tracklogs,
-  //       and the real tracks, with the tracklog styles.
+  //       Some tracklog entries may be continuation entries, so we turn these
+  //       into real_track_list.size() <= tr_count tracks.
+  //       If ts_count != real_track_list.size() we don't know how to line up
+  //       the tracklogs, and the real tracks, with the tracklog styles.
   if (ts_count != real_track_list.size()) {
-    warning(MYNAME ": The number of tracklog entries with the new flag set doesn't match the number of tracklog style entries.");
+    warning(MYNAME ": The number of tracklog entries with the new flag "
+           "set doesn't match the number of tracklog style entries.\n"
+           "  This is unexpected and may indicate a malformed input file.\n"
+           "  As a result the track names may be incorrect.\n");
   }
+  // Read the entire tracklog styles section whether we use it or not.
   for (i = 0; i != ts_count; i++) {
     QString tname = fread_string(file_in);
     fread_discard(file_in, 12);
diff --git a/main.cc b/main.cc
index d19a6fd69d15c08406343b26135672cebbcbdf63..cbf1d36211500e7b9191d08cac3fd3ccae4d7d24 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -228,10 +228,10 @@ run(const char* prog_name)
   const char* fvec_opts = nullptr;
   int opt_version = 0;
   bool did_something = false;
-  queue* wpt_head_bak; /* #ifdef UTF8_SUPPORT */
-  RouteList* rte_head_bak, *trk_head_bak; /* #ifdef UTF8_SUPPORT */
-  signed int wpt_ct_bak;  /* #ifdef UTF8_SUPPORT */
-  bool lists_backedup;  /* #ifdef UTF8_SUPPORT */
+  queue* wpt_head_bak;
+  RouteList* rte_head_bak, *trk_head_bak;
+  signed int wpt_ct_bak;
+  bool lists_backedup;
   QStack<QargStackElement> qargs_stack;
 
   // Use QCoreApplication::arguments() to process the command line.
index 8868b1a2130fc8d94da02236d2dee620a645abb4..3f85066c2e0c1f8301a437a2eb74f9080344786e 100644 (file)
@@ -40,9 +40,14 @@ void ReverseRouteFilter::reverse_route_wpt(const Waypoint* waypointp)
   prev_new_trkseg = curr_new_trkseg;
 }
 
-void ReverseRouteFilter::reverse_route_head(const route_head* rte)
+void ReverseRouteFilter::reverse_route_head(const route_head* rte_hd)
 {
-  route_reverse(rte);
+  /* Cast away const-ness */
+  auto rh = const_cast<route_head*>(rte_hd);
+  queue* elem, *tmp;
+  QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) {
+    ENQUEUE_HEAD(&rh->waypoint_list, dequeue(elem));
+  }
   prev_new_trkseg = 1;
 }
 
index 2c5c0331961338cc9aa69e46a73f07efb0be9024..c3b5742ab4a3543f64b296ed6b6970d29d0296c5 100644 (file)
--- a/route.cc
+++ b/route.cc
@@ -152,17 +152,6 @@ route_disp(const route_head* /* rh */, std::nullptr_t /* wc */)
 // wc == nullptr
 }
 
-void
-route_reverse(const route_head* rte_hd)
-{
-  /* Cast away const-ness */
-  auto rh = const_cast<route_head*>(rte_hd);
-  queue* elem, *tmp;
-  QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) {
-    ENQUEUE_HEAD(&rh->waypoint_list, dequeue(elem));
-  }
-}
-
 void
 route_disp_session(const session_t* se, route_hdr rh, route_trl rt, waypt_cb wc)
 {
@@ -447,7 +436,7 @@ RouteList::add_wpt(route_head* rte, Waypoint* wpt, bool synth, const QString& na
   rte->rte_waypt_ct++; /* waypoints in this route */
   ++waypt_ct;
   if (synth && wpt->shortname.isEmpty()) {
-    wpt->shortname = QString().sprintf("%s%0*d", CSTRc(namepart), number_digits, waypt_ct);
+    wpt->shortname = QString("%1%2").arg(namepart).arg(waypt_ct, number_digits, 10, QChar('0'));
     wpt->wpt_flags.shortname_is_synthetic = 1;
   }
   update_common_traits(wpt);